package com.example.oauth.controller;


import com.example.oauth.entity.Role;
import com.example.oauth.mapper.RoleMapper;
import com.example.oauth.service.IRoleService;
import com.example.oauth.tracing.annotation.OwlTrace;
import lombok.extern.slf4j.Slf4j;
import com.example.oauth.tracing.annotation.OwlTrace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 付青建
 * @since 2021-11-16
 */
@Slf4j
@RestController
@RequestMapping("role")
public class RoleController {
    @Autowired
    private IRoleService roleService;
    @Autowired
    private RoleMapper roleMapper;
    @OwlTrace
    @GetMapping("getRoles")
    public Role getRoles(Integer id){
        return roleService.getById(id);
    }
    @OwlTrace
    @GetMapping("getAllRoles")
    public List<Role> getAllRoles(){
        log.info("查询所有角色");
        return roleService.getAllRole();
    }
}
